package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.BusinessEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author dxd
 * @since 2020-09-03
 */
public interface DsBusinessMapper extends BaseMapper<BusinessEntity> {

    @Select("select id,business_name,business_type  from ds_business")
    @Results(id = "id", value = {
            @Result(property = "businessName", column = "business_name", javaType = String.class),
            @Result(property = "businessType", column = "business_type", javaType = String.class),
    })
    List<Map> listTables();

    @Delete("delete from ds_business where business_type = #{businessType}")
    void deleteByBusiness(String businessType);
}
